package com.edu.test;

import com.edu.bean.User;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Properties;

public class MyTest02 {


    ApplicationContext context = null;

    @Before
    public void init(){
        context = new ClassPathXmlApplicationContext("spring-ioc2.xml");
    }


    @Test
    public void test01(){
         User user = context.getBean("user", User.class);
//         System.out.println(user);
//         System.out.println(user.getCar());
//         System.out.println(user.getPhone());
//        System.out.println(user.getShoes());
//        System.out.println(user.getRelations());
        User user2 = context.getBean("user", User.class);
        System.out.println(user == user2);

    }


    @Test
    public void test02(){
        System.out.println("-----");
        Object stu1 = context.getBean("stu");
        System.out.println(stu1);
        Object stu2 = context.getBean("stu");
        System.out.println(stu2);
        System.out.println(stu1 == stu2);

    }





}
